<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 不含税收入额高于3360元的， 
        应纳税所得额=［（不含税收入额-速算扣除数）×（1-20%）］÷［1-税率×（1-20%）］
         应纳个人所得税税额=应纳税所得额×适用税率-速算扣除数

 -->
    请输入工资:
    <input id="money" type="text">
    <input type="button" value="所得税计算" onclick="fn()">
    所交税为 :<input id="result" type="text">
    <!-- <input type="button" value=" 还有多少:" onclick="pn()">  -->
    <input id="resultMoney" type="text">
    <!-- <script>
        function fn() {
            var money = document.getElementById("money").value / 1
            var sum = 0;
            if (money <= 5000) {
                sum = 0;
            }
            else if (money <= 8000) {
                sum = money * 0.03;
            }
            else if (money <= 17000) {
                sum = money * 0.1;
            }
            else if (money < 30000) {
                sum = money * 0.2;
            }
            else if (money < 40000) {
                sum = money * 0.25;
            }
            else {
                sum = money * 0.25;
            }
            document.getElementById("result").value = sum;
            document.getElementById("resultMoney").value = money-sum;
        }
    </script>  -->

    <script>
        function fn01(money) {
            money = money / 1
            var sum = 0;
            var yourMoney = 0;
            if (money <= 5000) {
                sum = 0;
            }
            else if (money <= 8000) {
                sum = money * 0.03;
            }
            else if (money <= 17000) {
                sum = money * 0.1;
            }
            else if (money < 30000) {
                sum = money * 0.2;
            }
            else if (money < 40000) {
                sum = money * 0.25;
            }
            else {
                sum = money * 0.25;
            }

            return sum;
            

        }

        function fn() {
            var y=document.getElementById("money").value;
            var value = fn01(y);
            document.getElementById("result").value = value;
             x=fn01(y);
            document.getElementById("resultMoney").value=(y-x);
        }
    
    </script>

</body>

</html>